{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[Sven Kreiss](https://www.svenkreiss.com/), 2020\n",
    "\n",
    "# Contribute\n",
    "\n",
    "Before we can accept contributions, you need to become a CLAed contributor.\n",
    "E-mail a signed copy of the\n",
    "[CLAI](https://github.com/vita-epfl/openpifpaf/blob/master/CLAI.txt)\n",
    "(and if applicable the\n",
    "[CLAC](https://github.com/vita-epfl/openpifpaf/blob/master/CLAC.txt))\n",
    "as PDF file to research@svenkreiss.com.\n",
    "\n",
    "\n",
    "## Modify Code\n",
    "\n",
    "For development of the openpifpaf source code itself, you need to clone this repository and then:\n",
    "\n",
    "```sh\n",
    "pip3 install numpy cython\n",
    "pip3 install --editable '.[dev,train,test]'\n",
    "```\n",
    "\n",
    "The last command installs the Python package in the current directory\n",
    "(signified by the dot) with the optional dependencies needed for training and\n",
    "testing. If you modify `functional.pyx`, run this last command again which\n",
    "recompiles the static code.\n",
    "\n",
    "Develop your features in separate feature branches. \n",
    "Create a pull request with your suggested changes. Make sure your code passes\n",
    "`pytest` and `pylint` checks."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Profile Decoder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!python -m openpifpaf.predict coco/000000081988.jpg --no-download-progress --debug --profile-decoder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!flameprof profile_decoder.prof > profile_decoder_flame.svg"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![decoder flame graph](profile_decoder_flame.svg)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There is a second output that is generated from the Autograd Profiler. This can only be viewed in the Chrome browser: \n",
    "* open `chrome://tracing`\n",
    "* click \"Load\" in the top left corner\n",
    "* select `decoder_profile.1.json`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Documentation Build Env"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip freeze"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Scratch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Uncomment when using on Google Colab:\n",
    "# !pip install --upgrade openpifpaf==0.11.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!python -m openpifpaf.predict --version"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.4 64-bit ('venv3': venv)",
   "name": "python37464bitvenv3venve864f70b47a24f709eace0523e013bb0"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4-final"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
